<template>
  <div class="hello">
    <!-- <h2>东软HIS</h2> -->
    <el-button @click="submitClick">查询用户信息</el-button>
    <el-button @click="submitClickin">查询用户信息</el-button>
    <el-table :data="msg" style="width: 100%">
        <el-table-column prop="userName" label="登录名" width="180"></el-table-column>
        <el-table-column prop="realName" label="真实名" width="180"></el-table-column>
        <el-table-column prop="userType" label="用户类型" width="180"></el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
                 <el-button size="mini" @click="getIdClickup(scope.$index, scope.row)">编辑</el-button>
                 <el-button size="mini" type="danger"  @click="getIdClickde(scope.$index, scope.row)">删除</el-button>
          </template>
        </el-table-column>
    </el-table>
    </div>
</template>

<script>
 export default {
  name: 'HelloWorld',
  mounted:function(){
    this.submitClick();
  },
  data () {
    return {
      msg: []
    }
  },
  methods:{
    submitClick(){
      let _this = this;
    this.$axios.get("/neusys/user/queryAllUser")
      .then(response=>{
        this.msg=response.data;
      })
      .catch();
    },
    submitClickin(){
      let _this = this;
    this.$axios.get("/neusys/user/insert1")
      .then(response=>{
        this.msg=response.data;
      })
      .catch();
    },
    getIdClickup(index,row){
      let _this = this;
      this.$axios.get("/neusys/user/update",{
        params:{
          id:this.msg[index].id
        }
      })
      .then(response=>{
        alert("ok");
      })
      .catch()
    },
    getIdClickde(index,row){
      let _this = this;
      this.$axios.get("/neusys/user/delet",{
        params:{
          id:this.msg[index].id
        }
      })
      .then(response=>{
        alert("ok");
      })
      .catch()
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
